package cn.yunbamboos.db;

import cn.yunbamboos.db.core.DefaultDB;
import cn.yunbamboos.db.core.H2DB;
import cn.yunbamboos.db.core.MySQLDB;

public class DBFactory {

    public static IDB getDB() {
        boolean check = "true".equals(System.getProperty("CHECK_DB", "false"));
        String driver = System.getProperty("DB_DRIVER");
        if(check){
            if("com.mysql.cj.jdbc.Driver".equals(driver)){
                return new MySQLDB();
            } else if("org.h2.Driver".equals(driver)){
                return new H2DB();
            }
        }
        return new DefaultDB();
    }
}
